<?php

@date_default_timezone_set('PRC');
header('Content-type: text/html; charset=utf8');
//定义时间

if($_SERVER['REQUEST_METHOD'] == "POST"){

	include "Conn.php";
	include "function.php";

	$Type = trim(isset($_POST["Type"])?$_POST["Type"]:'html');//请求类型
	$UserName = trim(isset($_POST["UserName"])?$_POST["UserName"]:'');//请求类型
	$PassWord = trim(isset($_POST["PassWord"])?$_POST["PassWord"]:'');//请求类型
	
	
			if(empty($UserName)){
				$msg = array('code'=>111,"msg"=>'用户名为空');
				TuiChu($msg ,$Type);
			}
			if(empty($PassWord)){
				$msg = array('code'=>112,"msg"=>"密码为空");
				TuiChu($msg,$Type);
			}
			
			if ($name && $passowrd){
				$sql = "SELECT * FROM User WHERE username = '$UserName' and password='$PassWord'";
				$res = mysql_query($sql,$con);
				$rows=mysql_num_rows($res);
				if($rows){
					//header("refresh:0;url=index.html");//跳转页面，注意路径
					$msg = array('code'=>115,"msg"=>"登陆成功");
					TuiChu($msg,$Type);
				}
				$msg = array('code'=>113,"msg"=>"用户名密码错误");
				TuiChu($msg,$Type);
			}else {
				$msg = array('code'=>114,"msg"=>"用户名密码为空");
				TuiChu($msg,$Type);
			}
}else{
	TuiChu("请正确访问页面");
	
}